package com.example.design.shejimoshi.action.postprocessor;

import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;

@Order(1)
@Component
public class CheckParamPostProcessor implements AlarmPostProcessor {
    @Override
    public void postProcessBeforeInitialization(AlarmBO alarmBO) {
        if(alarmBO.getAlarmCode()==null){
            throw new IllegalArgumentException("未提供AlarmCode告警标识");
        }
        if (alarmBO.getAlarmStartTime() == null) {
            alarmBO.setAlarmStartTime(LocalDateTime.now());
        }
    }

    @Override
    public void postProcessAfterInitialization(AlarmBO alarmDO) {

    }
}
